package com.toune.villager.adapter

import android.graphics.Color
import android.widget.ImageView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.qmuiteam.qmui.layout.QMUILinearLayout
import com.toune.villager.R
import com.toune.villager.bean.HomeGridMenuBean
import com.toune.dltools.DLColorTool

class HomeGridMenuAdapter(layoutResId: Int, data: MutableList<HomeGridMenuBean>?) :
    BaseQuickAdapter<HomeGridMenuBean, BaseViewHolder>(layoutResId, data) {
    override fun convert(holder: BaseViewHolder, item: HomeGridMenuBean) {
        val view = holder.getView<QMUILinearLayout>(R.id.menuLv)
        view.setBackgroundColor(Color.parseColor(DLColorTool.randomColor()))
        holder.setText(R.id.nameTv, item.menuName)
        val imageView = holder.getView<ImageView>(R.id.srcIv)
        imageView.setImageResource(item.srcId)
    }
}